package com.ubhave.powertracker;

import java.util.Date;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

public class ChargingBroadcastReciever extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {
		Log.i("POWeR Tracker Sensor: ", "ChargeEvent");
		
		intent.getAction();
		
		//Toast.makeText(PowerTrackerApplication.getContext(), "POWeR Tracker Charge Event.", Toast.LENGTH_SHORT).show();
		SharedPreferences settings;
		settings=PreferenceManager.getDefaultSharedPreferences(PowerTrackerApplication.getContext());
		
		if(settings.getBoolean("SensorsOn", false)){
			SharedPreferences.Editor editor = settings.edit();
			editor.putString("sensorLog", settings.getString("sensorLog", "")+"Push Sensor: Charging() "+"TimeStamp("+new Date()+"), ");
			editor.commit();
		}
				
	}
	
	
	
}